#include "component/port/fatfs/vsf_fatfs.h"

struct usrapp_t
{
	struct
	{
		struct fakefat32_file_t root_dir[3];
		struct fakefat32_file_t gpio_dir[5];
	} fakefat32;

	struct
	{
		struct vsfscsi_device_t scsi_dev;
		struct vsfscsi_lun_t lun[1];

		struct vsf_scsistream_t scsistream;
		struct vsf_mal2scsi_t mal2scsi;
		struct vsfmal_t mal;
		struct fakefat32_param_t fakefat32;
		uint8_t *pbuffer[2];
		uint8_t buffer[2][512];
	} mal;

	struct
	{
		struct
		{
			struct vsfusbd_MSCBOT_param_t param;
		} msc;
		struct vsfusbd_iface_t ifaces[1];
		struct vsfusbd_config_t config[1];
		struct vsfusbd_device_t device;
	} usbd;

	struct
	{
		VSFPOOL_DEFINE(vfsfile_pool, struct vsfile_vfsfile_t, APPCFG_VSFILE_NUM);
		struct vsfile_t *file;

		struct vsfmim_t fat_mal;

		struct vsffat_t fat;
		struct vsf_fatfs_t fatfs;

		uint8_t buffer[4];
		uint32_t size;
	} fs;

	struct vsfsm_t sm;
	struct vsfsm_pt_t pt;
	struct vsfsm_pt_t caller_pt;
	struct vsfsm_thread_t thread;
	uint8_t stack[2048];
};

extern struct usrapp_t usrapp;

void usrapp_initial_init(struct usrapp_t *app);
void usrapp_srt_init(struct usrapp_t *app);
